//package cn.iocoder.yudao.core.quartz.config;
//
//import com.alibaba.ttl.TtlRunnable;
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.BeanPostProcessor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableAsync;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//import org.springframework.stereotype.Component;
//
///**
// * 异步任务 Configuration
// */
//@Configuration
//@EnableAsync
//public class AsyncConfiguration implements InitializingBean {
//
//
////    @Autowired
//    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
//
//
//    @Bean
//    public BeanPostProcessor threadPoolTaskExecutorBeanPostProcessor() {
//        return new BeanPostProcessor() {
//
//            @Override
//            public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
//                if (!(bean instanceof ThreadPoolTaskExecutor)) {
//                    return bean;
//                }
//                // 修改提交的任务，接入 TransmittableThreadLocal
//                ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) bean;
//                executor.setTaskDecorator(TtlRunnable::get);
//                return executor;
//            }
//
//        };
//    }
//
//    @Override
//    public void afterPropertiesSet() throws Exception {
////        threadPoolTaskExecutor.setTaskDecorator(TtlRunnable::get);
//    }
//}
